<?php

namespace App\Exceptions;

use Exception;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Symfony\Component\HttpFoundation\Response as ResponseAlias;
use Throwable;

class InvalidRequestException extends Exception
{
    public function __construct(string $message = '',int $code = 400)
    {
        parent::__construct($message,$code);
    }

    public function render(Request $request): JsonResponse
    {
        return response()->json([
            'code' => $this->code,
            'msg' => $this->message
        ], $this->code);
    }
}
